package com.example.design.adapter.voltage.v3.adapter;

import com.example.design.adapter.voltage.v3.adaptee.AC;
import com.example.design.adapter.voltage.v3.target.DC5Target;

/**
 * @Description 日式变压器适配器类
 * @ClassName JapanPowerAdapter
 * @Author Administrator
 * @Date 2020/5/13 13:22
 * @Version 1.0.0
 */
public class JapanPowerAdapter implements DC5Target {

    public static final int voltage = 110;

    @Override
    public boolean support(AC ac) {
        return voltage == ac.outputAC();
    }

    @Override
    public int output5V(AC ac) {
        int adapteeOutput = ac.outputAC();
        int adapterOutput = adapteeOutput/22;
        System.out.println("使用JapanPowerAdapter变压适配器，输入AC:" + adapteeOutput + "V" + "，输出DC:" + adapterOutput + "V");
        return adapterOutput;
    }
}
